/**################################################################################################**   
# Copyright (c)  2008  Carlos Galindo.   
# Permission is granted to copy, distribute and/or modify this document   
# under the terms of the GNU Free Documentation License, Version 1.2   
# or any later version published by the Free Software Foundation;   
# Provided 'as is' with no warranties, nor shall the autor be responsible for any mis-use of the same.     
# A copy of the license is included in the section entitled 'GNU Free Documentation License'.   
#   
#   CJAX FRAMEWORK 3.0.0RC2                $     
#   ajax made easy with cjax                    
#   -- DO NOT REMOVE THIS --                    
#   -- AUTHOR COPYRIGHT MUST REMAIN INTACT -   
#   CJAX FRAMEWORK  3.0.0RC2               $     
#   Written by: Carlos Galindo                  
#   Website: www.cjax.net                     $      
#   Email: cjxxi@msn.com    
#   Date: 2/12/2007                           $     
#   File Last Changed:  03/24/2009            $     
**####################################################################################################*/     

var extension = new extension();


function extension() {
	this.extensions = [];
	this.buffer = [];
	this.hook		=		function(buffer)
	{
		var e = buffer.xml('extension');
		var ext = buffer.xml('ext');
		this.buffer[e] = buffer;
		var s = buffer.xml('seconds');
		var base = buffer.xml('base').replace('__base__',CJAX.vars['base'])
		base += e;
		if(ext) {
			base+=ext;
		} else {
			base+'.js';
		}
		
		if(base.loaded()) {
			var method = buffer.xml('method');
			CJAX.script.action(e+'.'+method,buffer,s);
		} else {
			extension.load(base,e,buffer);	
		}
		return true;
	}
	
	
	this.load		=	function(base,e,buffer)
	{
		return CJAX.script.load(base,e,buffer);
	}
	
	this.loaded		=	function(path) {
		return CJAX.script.loaded(path);
	}

}